package com.flashcash.kotlin.activity

import android.os.Bundle
import android.view.View
import android.widget.ImageButton
import android.widget.TextView
import com.flashcash.solu.R
import com.flashcash.solu.app.base.BaseActivity
import com.flashcash.solu.app.base.BaseActivityView
import com.flashcash.solu.app.base.presenter.BaseActivityPresenter
import com.flashcash.solu.app.base.presenter.BaseActivityPresenterImpl
import com.flashcash.kotlin.data.PolicyType
import org.jetbrains.anko.find
import org.jetbrains.anko.sdk25.coroutines.onClick

/**
 * Created by XLEO on 2018/3/30.
 */
class PolicyListActivity:BaseActivity<PolicyListActPresenter>(),PolicyListActView{

    companion object {
        val TYPE = "type"
    }
    override fun getLayoutResId(): Int {
        return R.layout.activity_policy_list
    }

    override fun init() {
        find<TextView>(R.id.id_textview_title).text = getString(R.string.title_activity_policy_list)
        find<ImageButton>(R.id.id_imagebutton_back).onClick { finish() }
        find<ImageButton>(R.id.id_imagebutton_info_list).visibility = View.GONE

        find<TextView>(R.id.tv_privacy_policy).onClick {
            val bundle = Bundle()
            bundle.putCharSequence(TYPE,PolicyType.PRIVACY.name)
            changeTo(PolicyActivity::class.java,bundle)
        }
        find<TextView>(R.id.tv_loan_agreement).onClick {
            val bundle = Bundle()
            bundle.putCharSequence(TYPE,PolicyType.LOAN_AGREEMENT.name)
            changeTo(PolicyActivity::class.java,bundle)
        }
    }

    override fun initPresenterImpl(): PolicyListActPresenter {
        return PolicyListActPreImpl()
    }
}

class PolicyListActPreImpl : PolicyListActPresenter,BaseActivityPresenterImpl() {

}

interface PolicyListActView:BaseActivityView {

}

interface PolicyListActPresenter:BaseActivityPresenter {

}
